package org.graduation.model.common.note;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.graduation.model.common.RBAC.RBACModelTag;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("note")
public class Note implements RBACModelTag {
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "note_id", type = IdType.ASSIGN_ID)
    private Long noteId;
    private Integer uid;
    private String title;
    private String content;
    // 提醒时间
    @TableField(value = "alarm_time")
    private Date alarmTime;
    @TableField(value = "delete_time")
    private Date deleteTime;

    @Override
    public Long getLongId() {
        return getNoteId();
    }

    @Override
    public Integer getId() {
        return -1;
    }

    public String getTitle() {
        return title == null ? "无标题" : title;
    }
}
